package base.generic.demo04;

import org.junit.Test;

/**
 * 泛型的递归类型限制 测试
 */
public class TestCase {
    @Test
    public void testCase1(){
        Integer[] nums = {-2,5,100,6};
        MinMax<Integer> mm = new MinMaxImpl<>(nums);
        System.out.println(mm.max());
        System.out.println(mm.min());


        Character[] characters = {'a','d','T','w','z'};
        MinMax<Character> mm2 = new MinMaxImpl<>(characters);
        System.out.println(mm2.max());
        System.out.println(mm2.min());


        //因Mouse类没有实现Comparable接口,Mouse是没法通过MinMax接口功能实现对Mouse对象的比较.
//        Mouse[] mouse = {new Mouse("Mickey", 2), new Mouse("Jerry", 2)};
//        MinMax<Mouse> mm3 = new MinMaxImpl<>(mouse);
    }
}
